﻿@model FCZLM.Core.Models.ProductCategorys
@using FCZLM.Core.Models
@{
    Layout = null;
   
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit</title>
    <link href="/layui/css/layui.css" rel="stylesheet" />
    
</head>

<body>

    <div>

        <div class="layui-card">

            <div class="layui-card-header">修改商品分类</div>

            <div class="layui-card-body">

                <form class="layui-form">

                    <input type="hidden" name="Id" value="@Model.Id" />

                    <div class="layui-form-item">

                        <label class="layui-form-label">商品分类名称</label>

                        <div class="layui-input-block">

                            <input type="text" value="@Model.Name" name="Name" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <label class="layui-form-label">商品分类描述</label>

                        <div class="layui-input-block">

                            <input type="text" value="@Model.Desc" name="Desc" required lay-verify="required" placeholder="请输入副标题" autocomplete="off" class="layui-input">

                        </div>

                    </div>

                    <div class="layui-form-item">

                        <div class="layui-input-block">

                            <button class="layui-btn" lay-submit lay-filter="editForm">修改</button><!--使用Ajax把formDemo改为editForm-->

                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>

                        </div>

                    </div>

                </form>

            </div>

        </div>

    </div>
    <script src="/layui/layui.js"></script>
    <script>
        //引入layui组件
        //layui.use("form", function () { });//使用Ajax方式需要把这行删除
        //使用Ajax方式
        layui.use(["form", 'layer'], function () {

            var form = layui.form;

            var $ = layui.$;//引入layui组件

            //监听提交

            form.on('submit(editForm)', function (data) {

                $.post("/fproductcategorys/edits", data.field, function (res) {

                    if (res.isSuccess) {

                        layer.msg(res.msg, function () {

                            parent.window.location.href = "/fproductcategorys/index"//parent加上它是父页面做跳转

                        });

                    } else {

                        layer.msg(res.msg)

                    }

                });

                return false;

            });

        });

    </script>

</body>

</html>
